<template>
  <el-container style="height: 700px; border: 1px solid #eee">
    <el-header style="text-align: right; font-size: 12px">
      <el-dropdown @command="command">
        <i class="el-icon-setting" style="margin-right: 15px"></i>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item :command="exit">退出登录</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
      <span v-if="manager != null">{{ manager.name }}</span>
    </el-header>
    <el-container>
      <el-aside width="200px" style="height: 640px;background-color: rgb(238, 241, 246)">
        <el-menu :router="true" :unique-opened="true">
          <el-menu-item index="/product">商品管理</el-menu-item>
          <el-menu-item index="/category">类别管理</el-menu-item>
          <el-menu-item index="/maOrder">订单管理</el-menu-item>
        </el-menu>
      </el-aside>
      <el-main style="height: 640px">
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
  name: "Index",
  data() {
    return {
      manager: null
    };
  },
  created() {
    this.getManager();
  },
  methods: {
    exit: function() {},
    getManager: function() {
      this.axios.get("/manager/after/manager").then(res => {
        this.manager = res.data.data;
      });
    },
    showProducts: function() {},
    command: function() {
      this.axios.get("/zteoa/emp/exit").then(res => {
        if (res.data) {
          this.$router.push("/login");
        }
      });
    }
  }
};
</script>

<style scoped>
.el-header {
  background-color: #b3c0d1;
  color: #333;
  line-height: 60px;
  padding-left: 0;
}

.el-aside {
  color: #333;
}
</style>